//
//  PresentCampaignViewController.m
//  MWSDKDemo
//
//  Created by 刘家飞 on 15/5/28.
//  Copyright (c) 2015年 cafei. All rights reserved.
//

#import "PresentCampaignViewController.h"
#import "UIImageView+WebCache.h"
#import "MWApi.h"
#import "Define.h"

@interface PresentCampaignViewController ()

@end

@implementation PresentCampaignViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MWApi pageviewStartWithName:@"presentCampaignView"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)viewDidAppear:(BOOL)animated
{
    [MWApi pageviewEndWithName:@"presentCampaignView"];
    
    [MWApi configAdViewWithKey:campaign3 withTargetView:_imgView withTargetViewController:self success:^(NSString *key, UIView *view, MWCampaignConfig *campaignConfig) {
        
        [_imgView sd_setImageWithURL:[NSURL URLWithString:campaignConfig.imageUrl] placeholderImage:nil];
        
    } failure:^(NSString *key, UIView *view, NSString *errorMessage) {
        
        //没有获取到相应的活动，该魔窗位自行处理，或隐藏或显示别的内容
        
    }];
}

- (void)doneBtn:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
